package com.mallcloud.mall.app.api.entity.dto;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "WxPay3RefundInfoDTO", description = "微信申请退款请求参数")
public class WxPay3RefundInfoDTO {

    @ApiModelProperty(value = "商户订单号")
    @JSONField(name = "out_trade_no")
    private String outTradeNo;

    @ApiModelProperty(value = "商户退款单号")
    @JSONField(name = "out_refund_no")
    private String outRefundNo;

    @ApiModelProperty(value = "退款原因")
    private String reason;

    @ApiModelProperty(value = "退款结果回调url")
    @JSONField(name = "notify_url")
    private String notifyUrl;

    @ApiModelProperty(value = "金额信息")
    private Amount amount;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public class Amount {
        @ApiModelProperty(value = "退款金额")//分
        private Long refund;

        @ApiModelProperty(value = "原订单金额")//分
        private Long total;

        @ApiModelProperty(value = "退款币种")
        private String currency = "CNY";
    }

    public Amount getAmount(Long refund, Long total) {
        return new Amount(refund, total, "CNY");
    }
}